//
//  BaseModel.m
//  Protect -A
//
//  Created by 付剑英 on 16/6/20.
//  Copyright © 2016年 付剑英. All rights reserved.
//

#import "BaseModel.h"

@implementation BaseModel



#pragma mark - ------------ 初始化 ---------------

-(instancetype)initWithDictionary:(NSDictionary *)dictionary{
    self = [super init];
    if (self) {
        //KVC 赋值
        [self  setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}

#pragma mark - ------------ 便利构造器 ---------------


+(instancetype)modelWithDictionary:(NSDictionary *)dictionary{
    id m = [[self alloc]initWithDictionary:dictionary];
    return m;
}

#pragma mark - ------------ 存字典的数组 ->存model的数组 ----------


+(NSMutableArray *)modelHandleWithArrar:(NSArray *)arr{
  
    //创建空数组
    NSMutableArray *mArr = [NSMutableArray array];
    
    //遍历存入数组中 得到字典的信息
    for (NSDictionary *dic in arr) {
        id m = [[self class]modelWithDictionary:dic];
        [mArr  addObject:arr];
    }
    return mArr;
}


#pragma mark - ------------ 没有匹配的值 ---------------


-(void)setValue:(id)value forUndefinedKey:(NSString *)key{


}



-(void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];
}









@end
